<template>
  <div class="ma-content-block lg:flex justify-between p-4">
    <!-- CRUD 组件 -->
    <ma-crud :options="options" :columns="columns" ref="crudRef">
    </ma-crud>
  </div>
</template>
<script setup>
import { ref, reactive } from 'vue'
import priceAreaList from '@/api/finance/priceAreaList'
import { Message } from '@arco-design/web-vue'
import tool from '@/utils/tool'
import * as common from '@/utils/common'

const crudRef = ref()




const options = reactive({
  id: 'price_area_list',
  rowSelection: {
    showCheckedAll: true
  },
  pk: 'id',
  operationColumn: true,
  operationColumnWidth: 160,
  formOption: {
    viewType: 'drawer',
    width: "80%"
  },
  api: priceAreaList.getList,
  add: {
    show: true,
    api: priceAreaList.save,
    auth: ['finance:priceAreaList:save']
  },
  edit: {
    show: true,
    api: priceAreaList.update,
    auth: ['finance:priceAreaList:update']
  },
  delete: {
    show: true,
    api: priceAreaList.deletes,
    auth: ['finance:priceAreaList:delete']
  }
})

const columns = reactive([
  {
    title: "主键",
    dataIndex: "id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    commonRules: {
      required: true,
      message: "请输入主键"
    }
  },
  {
    title: "分区组",
    dataIndex: "parent_id",
    formType: "select",
    dict:{
        url: 'finance/priceArea/list',
        props: {label: 'name', value: 'id'},
        params:{
          select:'id,name'
        },
        translation: true,
    },
    search: true
  },
  {
    title: "名称",
    dataIndex: "name",
    formType: "input",
    search: true,
    commonRules: {
      required: true,
      message: "请输入名称"
    }
  },
  {
    title: "国家",
    dataIndex: "country",
    formType: "input",
    search: true
  },
  {
    title: "邮编开始",
    dataIndex: "post_start",
    formType: "input",
    search: true
  },
  {
    title: "邮编结束",
    dataIndex: "post_end",
    formType: "input",
    search: true
  },
  {
    title: "地址库",
    dataIndex: "address_code",
    formType: "input",
    search: true
  },
  {
    title: "创建者",
    dataIndex: "created_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "更新者",
    dataIndex: "updated_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "创建时间",
    dataIndex: "created_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "更新时间",
    dataIndex: "updated_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "删除时间",
    dataIndex: "deleted_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "备注",
    dataIndex: "remark",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  }
])
</script>
<script> export default { name: 'finance:priceAreaList' } </script>